

const path=require('path')
const webpack=require('webpack')
const htmlWebpackPlugin=require('html-webpack-plugin')
const VueLoaderPlugin = require('vue-loader/lib/plugin');

module.exports={
	entry:path.join(__dirname,'./src/main.js'),
	output:{
		path:path.join(__dirname,'./dist'),
		filename:'bundle.js'
	},
	devServer:{
		open:true,
		port:3000,//contentBase:'src',   //表示托管的跟路径
		hot:true   //表示热跟新
	},
	plugins:[
	new webpack.HotModuleReplacementPlugin(),
	new VueLoaderPlugin(),
	new htmlWebpackPlugin ({
		template:path.join(__dirname,'./src/index.html'),
		filename:'index.html'
		
	})
	],
	module:{
		rules:[
		{test:/\.css$/,use:['style-loader','css-loader']},
		{test:/\.(jpg|png|gif|jpeg|tff|ttf)$/,use:'url-loader'},
		{test:/\.vue$/,use:'vue-loader'},
		{test:/\.js$/,use:'babel-loader',exclude:/node_modules/},


		]
	},
	resolve:{
		alias:{
			"vue$":"vue/dist/vue.js"
		}
	}
}
//		{test:/\.(jpg|png|gif|jpeg|tff)$/,use:'url-loader?limit=1199861&name=[hash:8]-[name].[ext]'},
		//{test:/\.(tff|eot|svg|woff|woff2)$/,use:'url-loader'}